﻿namespace jzgl.Controller
{
    using System;
    using System.Data;
    using System.Data.SqlClient;

    internal class AutoBackDB
    {
        private SqlConnection conn = null;
        private ConnDB conndb = new ConnDB();

        private DataTable table = null;

        public AutoBackDB()
        {
            this.conn = this.conndb.GetConnString();
        }

        public int Show_AutoBackState()
        {
            int num = 0;
            try
            {
                try
                {
                    string sql = "select  state from AutoBack";
                    this.table = this.conndb.FillDataTable(sql);
                    num = int.Parse(this.table.Rows[0][0].ToString().Trim());
                }
                catch (Exception)
                {
                }
            }
            finally
            {
            }
            return num;
        }

        public int Update_AutoBackState(int state)
        {
            int num = 0;
            try
            {
                try
                {
                    string sql = "update AutoBack set state='" + state + "'";
                    num = this.conndb.Execute_Sql(sql);
                }
                catch (Exception)
                {
                }
            }
            finally
            {
            }
            return num;
        }
    }
}

